<div class="container main messages-container" ng-controller="MessageListCtrl">
    <div ng-show="doingQuery" style="z-index: 10000; position: absolute; width: 100%; text-align: center; height: 100%; padding-top: 300px;">
        <img title="Loading" src="/static/img/loading/loading51.gif">
    </div>
    <!-- 顶部功能区 -->
    <!-- Default panel contents -->
    <div  class="panel panel-default">
        <div class="panel-heading">
            <div class="text-center"><strong>{[moduleTitle|uppercase]}</strong></div>
            <div class="row">
                <div class="col-md-12">
                    <div class="message-box-type pull-left">
                        <div class="message-inbox pull-left">
                            <input ng-click="messageBoxType_change()" type="radio" ng-model="messageBoxType" value="inbox">Inbox
                        </div>
                        <div class="message-sent pull-left message-box-active">
                            <input ng-click="messageBoxType_change()" type="radio" ng-model="messageBoxType" value="sent">Sent
                        </div>
                        <div class="message-archive pull-left">
                            <input ng-click="messageBoxType_change()" type="radio" ng-model="messageBoxType" value="archive">Archive
                        </div>
                    </div>
                    <form name="form_query" ng-submit="query()" class="form-inline pull-right">
                        <!--
                        <button ng-show="!showMessageList" ng-click="back()" type="button" class="btn btn-primary">
                            <i class="fa fa-level-up fa-rotate-270 fa-lg"></i>
                        </button>
                        -->
                        <!--
                        <div class="form-group">
                            <label class="sr-only"></label>
                            <input type="text" class="form-control" ng-model="parameters.query" placeholder="Keywords"/>
                        </div>
                        <div class="form-group">
                            <label class="sr-only"></label>
                            <select class="form-control" name="limit" ng-model="parameters.limit">
                                <option value="20">20</option>
                                <option value="30">30</option>
                                <option value="50">50</option>
                                <option value="100">100</option>
                                <option value="0">Unlimited</option>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-info"> <i class="glyphicon glyphicon-search icon-white"></i> Search</button>
                        -->
                        <button ng-show="routeParams.messageType=='inquire'" ng-click="back_to_inquire()" type="button" class="btn btn-primary">
                            Back To Inquire
                        </button>
                    </form>
                </div>
            </div>
        </div>
        <div ng-show="objects.length == 0" class="rounded_corners no_result">
            <p>No Messages found.</p>
        </div>
        <div class="well" ng-show="objects.length > 0">
            <div ng-repeat="obj in objects">
                <table class="table evb-message-inbox">
                    <tr>
                        <td class="width-3 text-left">
                            <a href="javascript:;" ng-click="showMessageThread(obj)">
                                <i class="fa {[obj.messageAngle=='down'?'fa-angle-double-down':'fa-angle-double-right']}
                                 fa-lg"></i>
                            </a>
                            <img ng-show="obj.messageAngle=='down' && doingQueryMessageThread" title="Loading" src="/static/img/loading/loading1.gif">
                        </td>
                        <td class="width-1">
                            <a title="{[obj.email]}" class="color-1" href="javascript:;">
                                {[obj.email]} ({[obj.ids|countReplyByIds]})
                            </a>
                        </td>
                        <td>
                            <span class="pull-left text-overflow"
                                  title="{[obj.content]}">
                                {[obj.subject]} {[obj.content]}
                            </span>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            {[obj.created_on|fixDateTime]}
                        </td>
                    </tr>
                </table>
                <div class="messages-list" ng-show="obj.messageAngle=='down' && messageThread.length > 0 && !showMessageList || routeParams.messageType"  ts-wrapper>
                <div ng-repeat="obj in messageThread">
                    <accordion style="width:100px;" close-others="oneAtATime">
                        <accordion-group heading="{[obj.from_user_detail.email=='service@vectorbuilder.com'?'To '+obj.to_user_detail.email:'To Me']} &nbsp;&nbsp;{[obj.created_on|fixDateTime]}">
                            <h6>{[obj.created_on]}</h6>
                            <pre>{[obj.content]}</pre>
                            <div ng-show="obj.attachments.length>0">
                                <strong>Attachments</strong>
                                <ul class="attachment-ul" ng-show="obj.attachments.length>0">
                                    <li ng-repeat="fileObj in obj.attachments">
                                        <a href="{[fileObj.full_url]}" target="_blank">{[fileObj.filename]}</a>
                                    </li>
                                </ul>
                            </div>
                        </accordion-group>
                    </accordion>
                </div>
                    <div class="well">
                       <p><span class="css-1">To</span><strong>{[replyObj.from_user_detail.email]}</strong>
                           <span class="pull-right">
                               <input type="radio" ng-model="replyObj.SendType" value="canDo"> Can Do
                               <input type="radio" ng-model="replyObj.SendType" value="canNotDo"> Can't Do
                               <!--<input type="radio" ng-model="replyObj.type" value="doByVb"> Do By VB
                               <input type="radio" ng-model="replyObj.type" value="doByOther"> Do By Myself
                               -->
                           </span>
                       </p>
                       <p><span class="css-1">From </span> <strong>{[replyObj.to_user_detail.email]}</strong></p>
                        <hr>
                        <div id="message_reply_temp" ng-show="replyObj.SendType&&!routeParams.messageType" class="ng-include: '/static/js/views/detail/messageReplyTemp.html'"></div>
                        <div id="inquireMessageReplyTemp" ng-show="replyObj.SendType&&routeParams.messageType=='inquire'" class="ng-include: '/static/js/views/detail/inquireMessageReplyTemp.html'"></div>
                        <span ng-hide="replyObj.SendType">
                            <textarea ui-tinymce="ui-tinymce" ng-model="replyObj.replyContent" name="replyContent" class="col-md-12"></textarea>
                        </span>
                       <button type="button" ng-click="message_reply()" ng-disabled="!replyObj.replyContent&&!replyObj.SendType" class="btn btn-sm btn-cyagen">Send
                       </button>
                        <button ng-show="replyObj.SendType=='canDo'" type="button" ng-click="reedit()" ng-disabled="!replyObj.canDoObject" class="btn btn-sm btn-cyagen">Reedit
                       </button>
                    </div>
                </div>
            </div>
        </div>
        <div class="well" ng-show="!doingQuery && !objects.length > 0">
            <div class="well">
               <p><span class="css-1">To</span><strong>{[replyObj.from_user_detail.email]}</strong>
                   <span class="pull-right">
                       <input type="radio" ng-model="replyObj.SendType" value="canDo"> Can Do
                       <input type="radio" ng-model="replyObj.SendType" value="canNotDo"> Can't Do
                       <!--<input type="radio" ng-model="replyObj.type" value="doByVb"> Do By VB
                       <input type="radio" ng-model="replyObj.type" value="doByOther"> Do By Myself
                       -->
                   </span>
               </p>
               <p><span class="css-1">From </span> <strong>{[replyObj.to_user_detail.email]}</strong></p>
                <hr>
                <div id="message_reply_temp" ng-show="replyObj.SendType&&!routeParams.messageType" class="ng-include: '/static/js/views/detail/messageReplyTemp.html'"></div>
                <div id="inquireMessageReplyTemp" ng-show="replyObj.SendType&&routeParams.messageType=='inquire'" class="ng-include: '/static/js/views/detail/inquireMessageReplyTemp.html'"></div>
                <span ng-hide="replyObj.SendType">
                    <textarea ui-tinymce="ui-tinymce" ng-model="replyObj.replyContent" name="replyContent" class="col-md-12"></textarea>
                </span>
               <button type="button" ng-click="message_reply()" ng-disabled="!replyObj.replyContent&&!replyObj.SendType" class="btn btn-sm btn-cyagen">Send
               </button>
                <button ng-show="replyObj.SendType=='canDo'" type="button" ng-click="reedit()" ng-disabled="!replyObj.canDoObject" class="btn btn-sm btn-cyagen">Reedit
               </button>
            </div>
        </div>
    </div>
    <div ng-include="'/static/js/views/components/pager.html'" style="display: inline;"></div>
</div>